package com.course.cdspringboot.mapper;

import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface ReviewMapper {

    // 教师查看是否有需要审核的条目
    @Select("SELECT achievements.achievement_id, created_date, a.achievement_name, achievement_type.name achievement_type_name FROM achievements " +
            "jOIN (SELECT paper_name achievement_name, achievement_id FROM achievement_paper " +
            "UNION ALL " +
            "SELECT patent_name achievement_name, achievement_id FROM achievement_patent " +
            "UNION ALL " +
            "SELECT report_name achievement_name, achievement_id FROM achievement_academic_exchange) a ON a.achievement_id = achievements.achievement_id " +
            "JOIN achievement_type ON achievements.achievement_type_id = achievement_type.id " +
            "WHERE is_deleted = false AND review_status_id = 2 AND owner IN (SELECT uid FROM students WHERE teacher_id = #{uid}) ")
    public List<Map<String, Object>> findReviewItems(Long uid);

}